import request from '@/utils/request'

// 查询售后列表
export function listAfterSale (query) {
  console.log(query)
  return request({
    url: '/order/afterSale',
    method: 'get',
    params: query
  })
}

// 获取售后单详情
export function getAfterSaleInfo (id) {
  return request({
    url: '/order/afterSale/' + id,
    method: 'get',
  })
}

// 创建售后单
export function addAfterSale(data){
  return request({
    url: `/order/afterSale`,
    method: 'post',
    data: data
  })
}

// 用户取消售后单
export function revokeAfterSale(sn, data){
  return request({
    url: `/order/afterSale/revoke/` + sn,
    method: 'put',
    data: data
  })
}

//  审核 售后请求   /dev-api/order/afterSale/receive/{id}/innerStatus
export function afterSalesExamine (afterSaleSn, data) {
  return request({
    // url: `/order/afterSale/receive/${id}/innerStatus`,
    url: `/order/afterSale/review/${afterSaleSn}`,
    method: 'put',
    data: data,
  })
}

// /order/afterSale//{afterSaleSn}  售后线下退款
export function afterSalesReturn (afterSaleSn, data) {
  return request({
    url: `/order/afterSale/refund/${afterSaleSn}`,
    method: 'put',
    data: data,
  })
}
